home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / SPEAR.DEM < prev    next >
Text File  |  1991-04-29  |  2KB  |  78 lines

  1. PROGRAM d13r16(input,output,dfile);
  2. (* driver for routine SPEAR *)
  3. CONST
  4.    ndat=20;
  5.    nmon=12;
  6. TYPE
  7.    cityname = string[15];
  8.    monthname = string[4];
  9.    narray = ARRAY [1..ndat] OF real;
  10.    glsarray = narray;
  11. VAR
  12.    d,probd,probrs,rs,zd : real;
  13.    i,j : integer;
  14.    ave,data1,data2 : narray;
  15.    wksp1,wksp2,zlat : narray;
  16.    rays : ARRAY [1..ndat,1..nmon] OF real;
  17.    city : ARRAY [1..ndat] OF cityname;
  18.    mon : ARRAY [1..nmon] OF monthname;
  19.    txt : string[64];
  20.    dfile : text;
  21.  
  22. (*$I MODFILE.PAS *)
  23. (*$I SORT2.PAS *)
  24.  
  25. (*$I CRANK.PAS *)
  26.  
  27. (*$I ERFCC.PAS *)
  28.  
  29. (*$I GAMMLN.PAS *)
  30.  
  31. (*$I BETACF.PAS *)
  32.  
  33. (*$I BETAI.PAS *)
  34.  
  35. (*$I SPEAR.PAS *)
  36.  
  37. BEGIN
  38.    glopen(dfile,'table2.dat');
  39.    readln(dfile);
  40.    readln(dfile,txt);
  41.    read(dfile,city[1]);
  42.    FOR i := 1 to nmon DO read(dfile,mon[i]);
  43.    readln(dfile);
  44.    readln(dfile);
  45.    FOR i := 1 to ndat DO BEGIN
  46.       read(dfile,city[i]);
  47.       FOR j := 1 to nmon DO read(dfile,rays[i,j]);
  48.       read(dfile,ave[i]);
  49.       read(dfile,zlat[i]);
  50.       readln(dfile)
  51.    END;
  52.    close(dfile);
  53.    writeln(txt);
  54.    write(' ':15);
  55.    FOR i := 1 to 12 DO write(mon[i]:4);
  56.    writeln;
  57.    FOR i := 1 to ndat DO BEGIN
  58.       write(city[i]:15);
  59.       FOR j := 1 to 12 DO write(round(rays[i,j]):4);
  60.       writeln
  61.    END;
  62. (* check temperature correlations between different months *)
  63.    writeln;
  64.    writeln('Are sunny summer places also sunny winter places?');
  65.    writeln('Check correlation of sampled U.S. solar radiation');
  66.    writeln('(july with other months)');
  67.    writeln;
  68.    writeln('month','d':9,'st. dev.':14,'probd':11,
  69.          'spearman-r':15,'probrs':10);
  70.    FOR i := 1 to ndat DO data1[i] := rays[i,1];
  71.    FOR j := 1 to 12 DO BEGIN
  72.       FOR i := 1 to ndat DO data2[i] := rays[i,j];
  73.       spear(data1,data2,ndat,wksp1,wksp2,d,zd,probd,rs,probrs);
  74.       writeln(mon[j],d:12:2,zd:12:6,probd:12:6,
  75.             rs:13:6,probrs:12:6)
  76.    END
  77. END.
  78.